﻿using M_Bom.API.Application.Command.BomCommand;
using M_Bom_Domain;
using M_Bom_Domain.Dto;
using M_Bom_Repository.Interface;
using MediatR;

namespace M_Bom.API.Application.CommandHandler.BomCommandHandler
{
    public class BomBackfillCommandHandler : IRequestHandler<BomBackfillCommand, List<BomYGuan>>
    {
        protected readonly IBom bom;
        protected readonly IBomYGuan  bomYGuan;

        public BomBackfillCommandHandler(IBom bom, IBomYGuan bomYGuan)
        {
            this.bom = bom;
            this.bomYGuan = bomYGuan;
        }

        public async Task<List<BomYGuan>> Handle(BomBackfillCommand request, CancellationToken cancellationToken)
        {
            var res = await bomYGuan.GetAsync(o => o.Bombh == request.Bombh);
            return res;
        }
    }
}
